import 'package:flutter/material.dart';
import 'package:flutter_snail/pages/reading/recommend_activity_card.dart';
import 'package:flutter_snail/pages/reading/recommend_item.dart';

/// 推荐列表
class RecommendList extends StatefulWidget {
  const RecommendList({Key? key, required this.controller}) : super(key: key);

  final ScrollController controller;
  @override
  State<RecommendList> createState() => _RecommendListState();
}

class _RecommendListState extends State<RecommendList> {
  final List<int> list = List.generate(8, (index) => index);

  @override
  Widget build(BuildContext context) {
    return CustomScrollView(
      slivers: [
        SliverToBoxAdapter(
            child: RecommendActivityCard(
          list: list,
          controller: widget.controller,
        )),
        _buildArticleList(),
      ],
    );
  }

  Widget _buildArticleList() {
    return SliverList(
        delegate: SliverChildBuilderDelegate(
      (_, index) {
        return RecommendItem(index: index);
      },
      childCount: 10,
    ));
  }
}
